extends HBoxContainer




var data

signal attach_item(data)

func _ready():
	pass 



func set_data(data):
	self.data = data
	
	var id = data["id"]
	$id.text = str(id)
	$no.text = DataSource.pad_with_zeros(id, 3)
	
	$name.text = data["name"]
	$name.hint_tooltip = data.get("description", "")
	
	if DataSource.exist_texture_by_type(DataSource.assets_type.spirit, id):
		$icon.texture = DataSource.get_texture_by_type(DataSource.assets_type.spirit, id)
	else:
		$icon.texture = DataSource.get_texture_by_type(DataSource.assets_type.spirit, 0)
	
	# 增加hint提示
	$icon.hint_tooltip = DataSource.get_icon_path(DataSource.assets_type.spirit, id)
	
	
func _on_attachItem_button_up():
	emit_signal("attach_item", data)
